import { Body, Controller, HttpStatus, Post } from '@nestjs/common';
import { ApiBody, ApiCreatedResponse, ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { CreateUserDto } from 'src/modules/users/dto/create-user.dto';
import { AuthService } from './auth.service' 
@Controller('auth')
@ApiTags('鉴权模块')
export class AuthController {
    constructor(private readonly authService: AuthService) {}
    @Post('/login')
    @ApiOperation({
      summary: '用户登录',
      description: '账户名加密码进行登录',
    })
    @ApiBody({
      description: '用户信息',
      type: CreateUserDto,
    })
    @ApiResponse({
      status: HttpStatus.OK,
      description: "token",
    })
  
    async createUser(@Body() createUserDto: CreateUserDto) {
      return await this.authService.login(createUserDto)
    }
}
